package com.yangcsoft.modules.deptmanage.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yangcsoft.common.utils.PageUtils;
import com.yangcsoft.common.utils.Query;

import com.yangcsoft.modules.deptmanage.dao.ContractInfoDao;
import com.yangcsoft.modules.deptmanage.entity.ContractInfoEntity;
import com.yangcsoft.modules.deptmanage.service.ContractInfoService;


@Service("contractInfoService")
public class ContractInfoServiceImpl extends ServiceImpl<ContractInfoDao, ContractInfoEntity> implements ContractInfoService {
    @Autowired
    private ContractInfoDao dao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = params.get("key").toString();
        Page<ContractInfoEntity> page = this.selectPage(
                new Query<ContractInfoEntity>(params).getPage(),
                new EntityWrapper<ContractInfoEntity>()
                                             .like("contract_no",key)
                 .or()
                                                             .like("contract_name",key)
                 .or()
                                                             .like("contract_info",key)
                 .or()
                                                             .like("contract_type",key)
                 .or()
                                                             .like("contract_money",key)
                 .or()
                                                             .like("contract_status",key)
                 .or()
                                                             .like("company_no",key)
                 .or()
                                                             .like("customer_no",key)
                 .or()
                                                             .like("pay_all_item_count",key)
                 .or()
                                                             .like("pay_item_no",key)
                 .or()
                                                             .like("pay_item_money",key)
                 .or()
                                                             .like("pay_item_status",key)
                 .or()
                                                             .like("create_date",key)
                 .or()
                                                             .like("create_user",key)
                 .or()
                                                             .like("update_date",key)
                 .or()
                                                            .like("update_user",key)
                                    );

        return new PageUtils(page);
    }

    @Override
    public void save(ContractInfoEntity entity) {
        dao.save(entity);
    }


}
